package management_system;

public class Score {
    private Course course;
    private double score;
    public Score(Course course, double score) throws InvalidScoreException {
        if (score < 0 || score > 100)
            throw new InvalidScoreException("成绩必须在0~100之间，当前：" + score);
        this.course = course; this.score = score;
    }
    public double getPoint() {
        if (score >= 90) return 4.0;
        else if (score >= 85) return 3.7;
        else if (score >= 82) return 3.3;
        else if (score >= 78) return 3.0;
        else if (score >= 75) return 2.7;
        else if (score >= 72) return 2.3;
        else if (score >= 68) return 2.0;
        else if (score >= 66) return 1.7;
        else if (score >= 64) return 1.5;
        else if (score >= 60) return 1.0;
        else return 0.0;
    }
    public Course getCourse() { return course; }
    public double getScore()  { return score; }
}